<?php


namespace App\Dao;

use App\Model\ConfigDiscover;

class ConfigDiscoverDao extends AbstractDao
{


    public function where(array $where): \Hyperf\Database\Model\Builder
    {
        $builder = ConfigDiscover::query();

        foreach ($where as $field => $value) {
            switch ($field) {
                case 'ids':
                    if (!empty($value)) {
                        $builder->whereIn('id', $value);

                    }
                    break;
                default:
                    if (is_array($value)) {
                        $builder->where($field, $value[0], $value[1]);
                    } else {
                        $builder->where($field, $value);
                    }
            }
        }

        return $builder;
    }

}